<template>
    <van-sticky>
        <van-nav-bar title="订单" left-text="返回" left-arrow @click-left="onClickLeft" />
    </van-sticky>
    <div>
        <van-card v-for="(item,index) in orderList" :num="item.num" :price="item.goods_price":title="item.goods_name"
            :thumb="item.goods_small_logo" />
        <van-submit-bar :price="200" button-text="去支付" @submit="onSubmit" />

    </div>

<van-card
  num="2"
  price="2.00"
  desc="描述信息"
  title="商品标题"
  thumb="https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg"
/>


</template>

<script setup>
import axios from "axios"
import { ref } from "vue"
import {useRouter} from 'vue-router'
import {useCartStore} from '../store'
import {storeToRefs} from 'pinia'
const {allPrice,allCount} =storeToRefs(useCartStore());
const {orderList} =useCartStore();

const onSubmit = () => {
  axios.get('/api/pay', {
    params: {
      total_amount: (allPrice.value / 100),
      subject: '订单内容',
      body: '这是订单中所有的商品',
      out_trade_no: new Date().getTime()
    }
  }).then(res => {
    window.open(res.data)
  })
}
</script>

<style lang="scss" scoped></style>